@import "./variables.scss";

@mixin colorBtn($color) {
    background: $color;

    &:hover {
        color: $color;

        &:before,
        &:after {
            background: $color;
        }
    }
}

$primaryBtnColor: #FFF;

/* 主按钮，因为优先级的历史原因，不能移入 .el-button 中，也不能修改。使用 .sc-btn-primary 代替 */
.el-button--primary {
    background-color: $green;
    border-color: $green;

    span {
        color: $primaryBtnColor;
    }

    &:focus {
        background-color: $green;
        border-color: $green;
    }

    &:hover {
        background-color: $greenLight;
        border-color: $greenLight;
    }

    &.is-disabled {
        background-color: rgba(23, 186, 161, 0.65);
        border-color: rgba(83, 246, 221, 0.28);

        span {
            color: rgb(27, 29, 40);
        }

        &:hover {
            background-color: rgba(23, 186, 161, 0.65);
            border-color: rgba(83, 246, 221, 0.28);
        }
    }
}

.el-button.is-loading {
    &::before {
        background-color: rgba(0, 0, 0, .2);
    }
}

.el-button,
.el-button.is-loading {

    /* 主按钮*/
    &.sc-btn-primary {
        background-color: $green;
        border-color: $green;

        span,
        i {
            color: $primaryBtnColor;
        }

        &:focus {
            background-color: $green;
            border-color: $green;
        }

        &:hover {
            background-color: $greenLight;
            border-color: $greenLight;
        }

        &.is-disabled {
            filter: brightness(80%);
            background-color: $green;

            border-color: $green;

            span {
                color: rgb(27, 29, 40);
            }

            &:hover {
                background-color: $green;
                border-color: $green;
            }
        }
    }

    // 次按钮
    &.sc-btn-minor {
        border: 1px solid $green;
        color: $green;
        background-color: transparent;

        span,
        i {
            color: $green;
        }

        &.el-button:hover {
            border-color: $greenLight;
            color: $greenLight;

            span {
                color: $greenLight;
            }
        }
    }
    // 次按钮2-有底色
    &.sc-btn-minor2 {
        @extend .sc-btn-minor;
        background-color: $bgColorLight;
    }
    // 次按钮
    &.sc-btn-minor4 {
        border: 1px solid $textInfo4;
        color: $green;
        background-color: transparent;

        span,
        i {
            color: $green;
        }

        &.el-button:hover {
            border-color: $textInfo4;
            color: $greenLight;

            span {
                color: $greenLight;
            }
        }
    }

    &.sc-btn-normal {
        border: 1px solid rgba(222,230,255,0.2);
        color: $text;
        background-color: $bgColorLight;

        &.el-button:hover {
            color: $green;
        }
    }

    // 亮一点的幽灵按钮，常用于非按钮的地方。如单选按钮
    &.sc-btn-ghost-normal {
        border: 1px solid #5F626F;
        color: $text;
        background-color: transparent;
        opacity: 0.8;

        &.el-button:hover {
            opacity: 1;
        }
    }

    // 幽灵按钮
    &.sc-btn-ghost {
        border: 1px solid $btnTextColor;
        color: $btnTextColor;
        background-color: transparent;
        opacity: 0.4;

        &.el-button:hover {
            opacity: 0.6;
        }
    }

    //文字按钮
    &.sc-btn-text {
        border: none;
        padding: 2px;
        line-height: 12px;
        color: $btnTextColor;
        background-color: transparent;

        &:hover {
            color: $greenLight;
        }

        &.is-disabled {
            color: $disableText;
            background-color: transparent;

            &:hover {
                color: $disableText;
                background-color: transparent;
            }
        }
    }

    &.sc-btn-lark {
        border: none;
        color: $btnTextColor;
        background-color: $bgColorGray;

        &.el-button:hover {
            color: $greenLight;
        }
    }

    // 中等尺寸
    &.sc-btn-medium {
        padding: 6px 14px;
        line-height: 12px;
        font-size: 12px;
    }

    // 撑满父级
    &.sc-btn-full {
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.el-radio-button:focus:not(.is-focus):not(:active):not(.is-disabled) {
    box-shadow: none;
}

@mixin txtColorBtn($color) {
    color: $color;

    &:hover {
        color: $color;
    }
}

/* 文本按钮 */
.el-button--text {
    &.sc-green {
        @include txtColorBtn($green);

        span {
            color: $green;
        }
    }
}